package cn.hou.java.designpattern._01factory;

import sun.applet.Main;

public class Test {
	public static void main(String[] args) throws Exception {
		//通过简单工厂获取对象,好比直接去超时买水果,不用去地里摘
		Fruits apple = FruitsFactory.getFruits(Apple.class);
		Fruits banana = FruitsFactory.getFruits(Banana.class);
		apple.get();
		banana.get();
		
		
		//通过工厂方法模式获取水果,好比有个水果超市,去苹果摊位买苹果,香蕉摊位买香蕉
		//如果新添一个葡萄,可以添加一个葡萄摊位,必须在这个水果超市里面
		FuritsBaseFactory appFac=new AppleFactory();
		appFac.getFruits().get();
		FuritsBaseFactory banFac=new BananaFactorry();
		banFac.getFruits().get();
	}
}
